package com.study.zzedu.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.study.zzedu.R;
import com.study.zzedu.entity.AppointModel;
import com.study.zzedu.entity.YiDongModel;
import com.study.zzedu.ui.login.LoginActivity;
import com.study.zzedu.widget.DisExamDialog;
import com.study.zzedu.widget.InfoDialog;

import java.util.List;

public class AppointExamAdapter extends RecyclerView.Adapter<AppointExamAdapter.ViewHolder> {
    private List<AppointModel> m;
    public class ViewHolder extends RecyclerView.ViewHolder
    {
        private Button btn_dis_exam;

        private TextView tv_appoint_exam_num,tv_appoint_exam_name,tv_appoint_exam_time,tv_appoint_exam_location,tv_appoint_exam_type;
        public ViewHolder(View view){
            super(view);
            tv_appoint_exam_num = (TextView) view.findViewById(R.id.tv_appoint_exam_num);
            tv_appoint_exam_name = (TextView) view.findViewById(R.id.tv_appoint_exam_name);
            tv_appoint_exam_time = (TextView) view.findViewById(R.id.tv_appoint_exam_time);
            tv_appoint_exam_location = (TextView) view.findViewById(R.id.tv_appoint_exam_location);
            tv_appoint_exam_type = (TextView) view.findViewById(R.id.tv_appoint_exam_type);

            btn_dis_exam = (Button) view.findViewById(R.id.btn_dis_exam);
            btn_dis_exam.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    DisExamDialog ifd = new DisExamDialog.Builder(view.getContext()).create();
                    ifd.show();
                }
            });
        }
    }

    public AppointExamAdapter(List<AppointModel> yiDongModel) {
        m = yiDongModel;
    }

    public ViewHolder onCreateViewHolder(ViewGroup parent, int Viewtype) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_appointment_exam_item, parent, false);
        ViewHolder holder = new ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        if(m.size()<1)
            return;
        AppointModel yModel = m.get(position);
    }

    public int getItemCount() {
        return m.size();
    }
}